package cn.com.callback

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import cn.com.elite.EliteBean;
import cn.com.elite.PropertiesUtil;
import cn.com.elite.Util;
import java.util.Map;
/**
 * 
 * @author msjykf
 * 短期批次处理
    select taskid,batch_id,startdate,enddate,dk_system from obtask_batch where createdate>trunc(sysdate) 
	and acceptstate=-1 and taskid='6G7NC4' and to_char(sysdate,'hh24:mi')>='04:00'
 *
 */
public class ObBatchSchedTask implements CallBackInvoke{
	private static final Log log=LogFactory.getLog(ObBatchSchedTask.class);
	private String charset = "utf-8"; //字符集
	private int timeout = 100000;//请求超时时间
	private int enableSSLflag = 0;
	public void doCallBack(EliteBean eliteBean,String callBack,Map map,String body){
		def taskid = map.get("taskid");  //市场活动ID
		def batch_id = map.get("batch_id"); //批次号
		def startdate = map.get("startdate");  //开始时间
		def enddate = map.get("enddate"); //结束时间
		def dk_system = map.get("dk_system"); //TA类型
		PropertiesUtil properties = new PropertiesUtil();
		def jsonbody,url;
		if(taskid.equals("6G7NC4")) {
			jsonbody = "{\"batch_id\":\""+batch_id+"\",\"startdate\":\""+startdate+"\",\"enddate\":\""+enddate+"\",\"requesttype\": 1,\"dk_system\":\""+dk_system+"\"}";
			url = properties.readValue("crmip")+"OboundFailTrade"; //调用交易失败数据接口
			Util.doHttpPost(url,jsonbody,charset,timeout,enableSSLflag);
		}
	}
}